/**
 * Setvor project
 */
package setvor.npc.generator;

import java.io.*;

/**
 * @author julatec
 *
 */
abstract class AbstractNativeGenerator {

	protected PrintStream outHeader;
	protected PrintStream outStubs;
	
	protected TypeMapper.TypeMap typeMap;
	
	/**
	 * 
	 */
	public AbstractNativeGenerator(Class<?> clazz, OutputStream streamHeader, OutputStream streamStubs) {
		this.outHeader = new PrintStream(streamHeader);
		this.outStubs = new PrintStream(streamStubs);
		this.typeMap = TypeMapper.getTypeMap(clazz);
	}		
	
	protected abstract void writeHeader();
	
	protected abstract void writeStubs();
	
	public void finalize(){
		try{
			outHeader.close();
			outStubs.close();
			super.finalize();
		} catch (Throwable e) {
			e.printStackTrace();
		}
	}
	
	

}
